﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Barry.Model;

namespace Barry.Repository
{
    public class NewsDataAccess
    {
        public static bool Add(News news)
        {
            using (var session = NHibernateHelper.OpenSession())
            {
                session.SaveOrUpdate(news);
            }
            return true;
        }


        public static News Get(int id)
        {
            using (var session = NHibernateHelper.OpenSession())
            {
                return session.Get<News>(id);
            }
        }

        public static bool Update(News news)
        {
            using (var session = NHibernateHelper.OpenSession())
            {
                session.Update(news);
            }
            return true;
        }


    }
}
